<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1, user-scalable=no" />
    <title>个人中心</title>
    <link rel="stylesheet" href="css/index.css">
    <script src="js/rem_main.js"></script>
    <script src="js/fontnormal.js"></script>
</head>
<body>
<div class="wrapper user">
    <div class="user-top">
        <div class="user-bg"></div>
        <div class="user-con">
            @if(!empty($data['user']['wx_avatar']))
                <img src="{{$data['user']['wx_avatar'] or ''}}" class="head">
            @else
                <img src="images/head.png" class="head">
            @endif
            <p class="user-head">
                @if(!empty($data['user']['nickname']))
                    <?php echo !empty($data['user']['nickname']) ? base64_decode($data['user']['nickname']) : ''; ?>
                @else
                    <?php echo !empty($data['user']['name']) ? $data['user']['name'] : ''; ?>
                @endif
            </p>
            <?php
                if(!empty($data['user']['user_role']) && $data['user']['user_role'] > 1){
                    switch ($data['user']['user_role'])
                    {
                        case 2:
            ?>
                            <p class="user-tip">准代理</p>
            <?php
                            break;
                        case 3:
            ?>
                            <p class="user-tip">个代理</p>
            <?php
                            break;
                        case 4:
            ?>
                            <p class="user-tip">省代理</p>
            <?php
                            break;
                        case 5:
            ?>
                            <p class="user-tip">市代理</p>
            <?php
                            break;
                        case 6:
            ?>
                            <p class="user-tip">区代理</p>
            <?php
                            break;

                    }
                }else if(!empty($data['user']['user_role']) && $data['user']['user_role'] == 1){
            ?>
                    <p class="user-tip">普通用户</p>
            <?php
                }
            ?>
        </div>
    </div>
    <div class="user-sy">
        <?php if(!empty($data['user']['user_role']) && $data['user']['user_role'] > 1){?>
        <div class="sy-left">
                    剩余：<span><?php echo !empty($data['user']['point']) ? $data['user']['point'] : 0;?>点</span>
        </div>
        <div class="sy-right"><a href="/home/mymoney">我的收益</a> &gt;</div>
        <?php }?>
    </div>
    <div class="user-nav">
        <ul class="nav-ul">
            <li>
                <a href="/home/checkjc">
                    <i class="nav01"></i>
                    <p>申请检测</p>
                </a>
            </li>
            <li>
                <a href="/home/gettalk">
                    <i class="nav02"></i>
                    <p>报告查询</p>
                </a>
            </li>
            <li>
                <a href="/home/checkzx">
                    <i class="nav03"></i>
                    <p>申请咨询</p>
                </a>
            </li>
        </ul>
    </div>
    <div class="login-out">
        <a href="javascript:void(0);" class="out-btn">退出登录</a>
    </div>
</div>
<script src="js/jquery-1.9.1.min.js"></script>
<script src="layer/layer.js"></script>
<script>
    $(function () {
        $(".out-btn").on("click",function(){
            //success
            var index = layer.load(1, {
                shade: [0.1,'#fff'] //0.1透明度的白色背景
            });
            $.ajax({
                url: "/home/logout",
                type: "get",
                data: {},
                success: function (msg) {
                    layer.close(index);
                    var obj = eval("("+msg+")");
                    if(obj['code'] == 1)
                    {
                        layer.msg(obj['msg']);
                        setTimeout(function(){
                            location.href = "/home/index";
                        },1000);
                    }else if(obj['code'] == -1){
                        layer.msg(obj['msg']);
                    }
                },
                error: function () {
                    layer.close(index);
                    layer.msg("服务器繁忙,请稍后重试!");
                }
            });
        });
    });
</script>
</body>
</html>